proc Edattrs:
	rem ****************************************
	rem *** Notepad plug-in to modify the    ***
	rem *** dates (incl. date-status),       ***
	rem *** priority and done-status of the  ***
	rem *** current note.                    ***
	rem ***                                  ***
	rem *** Written 4/96 for NP 5.41         ***
	rem *** by Michael Baas CIS: 101523,1757 ***
	rem ****************************************
			local list$(51),ny$(6),n1$(255),n2$(255),ti$(255),prio%,bo%,it%,ul%,emph%,t$(255),i%,so%,tn$(20),sd&,dd&,dmin&,sdd%,ssd%,stat%,upv%
			list$="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"
			ny$="No,Yes"
			keepos%=pos		REM Cursor stays on current note
			upv%=0			REM flag whether or not to update projview
			sres%=0			REM Redraw?
			so%=0			REM Resort? (After change of prio)

			prio%=Val:(d.prio$)
			rem *** Due date ***				
			if d.pdt$<>""
				dd&=val:(d.pdt$)
				sdd%=2
			else
				dd&=days(day,month,year)
				sdd%=1
			endif

			rem *** Start date **
			if d.pn$<>""
				sd&=val:(d.pn$)
				ssd%=2
			else
				sd&=days(day,month,year)
				ssd%=1
			endif
			
			i%=day
			if (i%>28) and month=2
				i% = 28  REM  avoid Hugh's attacks !  
			endif
			dmin& = days(i%,month,year-3)

			if d.title$<>""
				ti$=d.title$
				tn$="Title"
			else
				ti$=d.n$
				tn$="Note[1..255]"
			endif

			stat%=0		REM Make sure only "known" values of stat are modified
			if d.stat$="1" 
				stat%=1
			elseif d.stat$="2"
				stat%=2
			endif

			dinit"ÄÄ Edit attributes ÄÄ 1996/MB"
			dedit ti$,tn$
			ddate  sd&,"Start date",dmin&,days(31,12,2049)
			dchoice ssd%,"Save start date",ny$
			ddate  dd&,"Due date",dmin&,days(31,12,2049)
			dchoice sdd%,"Save due date",ny$
			dchoice prio%,"Priority:",list$
			if stat%>0
				dchoice stat%,"Status.","Active,Done"
			endif
			if dialog
				if d.prio$<>fix$(prio%,0,2)	REM Modified priority
					d.prio$=fix$(prio%,0,2)
					so%=-1   
				endif
				if d.title$<>""
						if ti$<>d.title$
							d.title$=ti$
                                                        rem sres%=1
						endif
				else
					if ti$<>d.n$
						d.n$=ti$
                                                rem sres%=1
					endif
				endif

				if ssd%=2
					d.pn$=fix$(sd&,0,16)
				else
					d.pn$=""
				endif

				if sdd%=2
					d.pdt$=fix$(dd&,0,16)
					if d.un$=""
						d.un$=fix$(uniq:,0,16)
					endif
					upv%=-1
					so%=-1
				else				
					d.pdt$=""
				endif

				if stat%>0
					ti$=fix$(stat%,0,1)
					if ti$<>d.stat$		REM Modified status
						d.stat$=ti$
						so%=-1
					endif
				endif

				update		REM *** Update record ***
			
                        rem if so%                  REM Re-sort?
                                as:             REM This checks if sorting is on
                                supd%=1         REM This allows intelligent screen updating
                        rem endif
			if upv%			REM Update project viewer
                             wrproj:(1,0)
			endif
		endif
	return
endp
